#include<iostream>
#include<vector>
#include<set>

using namespace std;

int main()
{
	int n;
	cin >> n;
	set<int> s;
	vector<int> arr(n);
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
		s.insert(arr[i]);
	}
	
	int res = 0,last = INT_MIN, cnt = 0;
	for (auto it : s)
	{
		if (last + 1 == it)
			cnt++;
		else
		{
			res = max(res, cnt);
			cnt = 1;
		}
		last = it;
	}
	res = max(res, cnt);
	cout << res << endl;
	return 0;
}